package kr.pe.johnkim.chattingday.mobile.rest.service;

import kr.pe.johnkim.chattingday.mobile.domain.ChattingDayPrivateMessage;
import kr.pe.johnkim.chattingday.mobile.rest.dao.ChattingDayPrivateMessageDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author : johnkim <cale9797@gmail.com / Bettersoft Inc,.>
 * @Date : 12. 6. 12
 */
public class ChattingDayPrivateMessageServiceImpl implements ChattingDayPrivateMessageService {

    // SLF4J Logging
    private Logger logger = LoggerFactory.getLogger(ChattingDayPrivateMessageServiceImpl.class);

    @Autowired
    private ChattingDayPrivateMessageDao chattingDayPrivateMessageDao = null;
    
    /**
     * 쪽지를 등록 한다.
     *
     * @param chattingDayPrivateMessage
     * @return
     */
    @Override
    public boolean registerPrivateMessage(ChattingDayPrivateMessage chattingDayPrivateMessage) {
        logger.info("registerPrivateMessage");

        return chattingDayPrivateMessageDao.registerPrivateMessage(chattingDayPrivateMessage);
    }

    /**
     * 해당 쪽지를 비활성화 한다.
     *
     * @param chattingDayPrivateMessage
     * @return
     */
    @Override
    public boolean updateDeactivatePrivateMessage(ChattingDayPrivateMessage chattingDayPrivateMessage) {
        logger.info("updateDeactivatePrivateMessage");

        return chattingDayPrivateMessageDao.updateDeactivatePrivateMessage(chattingDayPrivateMessage);
    }

    /**
     * 쪽지함의 모든 메시지를 비활성화 한다.
     * (해당 사용자와 주고받은 모든 메시지를 비활성화 한다.)
     *
     * @param chattingDayPrivateMessage
     * @return
     */
    @Override
    public boolean updateDeactivatePrivateAllMessage(ChattingDayPrivateMessage chattingDayPrivateMessage) {
        logger.info("updateDeactivatePrivateAllMessage");

        return chattingDayPrivateMessageDao.updateDeactivatePrivateAllMessage(chattingDayPrivateMessage);
    }
}
